﻿// Decompiled with JetBrains decompiler
// Type: Commom.Util.IdUtil
// Assembly: MT5Trade, Version=1.0.0.0, Culture=neutral, PublicKeyToken=null
// MVID: 8045A2CB-DBD6-41AD-8804-F98CAC1BDC8D
// Assembly location: C:\projects\trade\trade_tool\trade0812\MT5Trade.dll

using System;

#nullable enable
namespace Commom.Util;

public static class IdUtil
{
  private static string _id;

  public static void SetId(string id) => IdUtil._id = id;

  public static void Reset() => IdUtil._id = (string) null;

  public static string ObjectId()
  {
    return !string.IsNullOrWhiteSpace(IdUtil._id) ? IdUtil._id : Commom.Util.ObjectId.GenerateNewStringId();
  }

  public static string GuidNoSpilt()
  {
    return !string.IsNullOrWhiteSpace(IdUtil._id) ? IdUtil._id : Guid.NewGuid().ToString("N");
  }

  public static Guid GetGuid()
  {
    return !string.IsNullOrWhiteSpace(IdUtil._id) ? IdUtil._id.ToGuid() : Guid.NewGuid();
  }
}
